/*******************************************************************************
 * Dreampalace
 *******************************************************************************
 * 
 * Dreampalace is a special dreamdiary which helps dreamers to understand their
 * dreams. You can find also many features in Dreampalace to learn and hold the
 * lucid state in your dreams.
 * 
 * *****************************************************************************
 *
 * Program	   : Dreampalace
 * Autor           : PRo (Peter Rogge)
 * Email           : rogge-peter@gmx.de
 * Homepage        : http://code.google.com/p/dreampalace
 * License	   : GNU General Public License 3.0
 * 
 *******************************************************************************
 * 
 * This file is part of the project Dreampalace. Dreampalace is free software:
 * you can redistribute it and/or modify it under the terms of the GNU General 
 * Public License as published by the Free Software Foundation in version 3 of
 * the License only.
 * 
 * Dreampalace is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * Dreampalace. If not, see <http://www.gnu.org/licenses/>.
 * 
 * The Dreampalace project designates this particular file as subject to the
 * "Classpath" exception as provided by the Dreampalace project in the GPL 
 * Version 3 section of the License file that accompanied this code.
 * 
 *******************************************************************************
 */
package de.pro.dreampalace.spi;

import de.pro.dreampalace.file.api.EFileTyp;
import de.pro.dreampalace.file.api.IFile;
import java.util.Date;

/**
 *
 * @author Peter Rogge (PRo) <rogge-peter@gmx.de>
 */
public final class File implements IFile {
    
    private long id = -19670728;
    
    private Date date = null;
    
    private EFileTyp fileTyp = null;
    
    private String content = null;
    private String title = null;
    
    public File(final EFileTyp fileTyp) {
        this.fileTyp = fileTyp;
    }

    @Override
    public final boolean equals(final Object obj) {
        if (obj == null) {
            return false;
        }
        if (this.getClass() != obj.getClass()) {
            return false;
        }
        
        final File other = (File) obj;
        if (this.getID() != other.getID()) {
            return false;
        }
        return true;
    }

    @Override
    public final int compareTo(final IFile file) {
        final int compareTo =  file.getDate().compareTo(this.getDate());
        
        return compareTo;
    }

    @Override
    public final String getContent() {
        return content;
    }

    @Override
    public final Date getDate() {
        return date;
    }

    @Override
    public EFileTyp getFileTyp() {
        return fileTyp;
    }

    @Override
    public final long getID() {
        return id;
    }

    @Override
    public final String getTitle() {
        return title;
    }

    @Override
    public final int hashCode() {
        int hash = 5;
        hash = 59 * hash + (int) (this.getID() ^ (this.getID() >>> 32));
        
        return hash;
    }

    @Override
    public final void setContent(final String content) {
        this.content = content;
    }

    @Override
    public final void setDate(final Date date) {
        this.date = date;
    }

    @Override
    public final void setID(final long id) {
        this.id = id;
    }

    @Override
    public final void setTitle(final String title) {
        this.title = title;
    }
}
